import model.Predict;
import model.Train;
import utils.IOUtils;
import utils.Transform;

import java.io.IOException;
import java.util.HashMap;

/**
 * Created by 梅晨 on 2017/7/20.
 */
public class test {
    public static void main(String[] args)throws IOException{
        String modelPath ="vector.mod";
        String dicPath="dicFile.txt";
        String trainLibSVMPath="traindata.txt";
        String testLibSVMPath="testdata.txt";
        String accuracyFilePath="accuracy.txt";
        String predictPath = "C:\\Users\\梅晨\\PycharmProjects\\weiboSpider\\newsDir";
        String date = new java.sql.Date(new java.util.Date().getTime()).toString();
        HashMap<String,Integer> trainData = IOUtils.getFilePathClassMap("C:\\Users\\梅晨\\PycharmProjects\\weiboSpider\\report",null);
        HashMap<String,Integer> traindata = Transform.splitData(trainData).get(0);
        HashMap<String,Integer> testData = Transform.splitData(trainData).get(1);
//        HashMap<String,Integer> testData = IOUtils.getFilePathClassMap(predictPath + "\\" + date);
        Train train = new Train(traindata,modelPath,dicPath,trainLibSVMPath);
        train.run();
        System.out.println("start predict");
        Predict predict = new Predict(testData,modelPath,dicPath,testLibSVMPath,trainLibSVMPath,accuracyFilePath);
        predict.run();
    }
}
